package util

import (
	"math"
	"strconv"
)

func IntToString(e int) string {
	return strconv.Itoa(e)
}
func StringToInt(e string) int {
	i, _ := strconv.Atoi(e)
	return i
}
func StringToInt64(e string) int64 {
	i, _ := strconv.ParseInt(e, 10, 64)
	return i
}
func StringToUInt64(e string) uint64 {
	i, _ := strconv.ParseUint(e, 10, 64)
	return i
}
func Int64toString(e int64) string {
	return strconv.FormatInt(e, 10)
}

func UIntToString(e uint) string {
	return strconv.Itoa(int(e))
}

func Int64ToString(e int64) string {
	return strconv.FormatInt(e, 10)
}

func Round(f float64, n int) float64 {
	pow10_n := math.Pow10(n)
	return math.Trunc((f+0.5/pow10_n)*pow10_n) / pow10_n // TODO +0.5 是为了四舍五入，如果不希望这样去掉这个
}
func Int64contains(s []int64, e int64) bool {
	for _, a := range s {
		if a == e {
			return true
		}
	}
	return false
}
